<script setup lang="ts">
import { onLaunch, onShow, onHide } from "@dcloudio/uni-app";
onLaunch(() => {
  console.log("App Launch");
});
onShow((option) => {
  //console.log("App Show",console.log(uni.$u.config.v));
  if(option!=null){
  	//uni.$tools.Toast("App.vue 慢病传来了id");
	if(option.referrerInfo?.extraData){
		uni.setStorageSync("mbuserid",option.referrerInfo?.extraData?.mbuserid);
		//uni.setStorageSync("logincode",option.referrerInfo?.extraData?.logincode);
	}
	if(option.query?.mbuserid){
		uni.setStorageSync("mbuserid",option.query?.mbuserid);
	}
	/*
	if(option.query?.logincode){
		uni.setStorageSync("logincode",option.query?.logincode);
	}
	//*/
  	console.log(option);
	uni.login({
		  provider: 'weixin',
		  onlyAuthorize:true,
		  success:e=> {
			//登录。注册会员信息
			if(e.errMsg==='login:ok' && e.code!=null){
				uni.setStorageSync("logincode",e.code);	
				console.log("AppVue Logincode",e.code);
			}
		  },
		  fail:err=>{
			  uni.$tools.Toast(""+err);
		  }
	});	
  }
  //*/
});
onHide(() => {
  console.log("App Hide");
});
</script>
<style lang="scss">
	/* 注意要写在第一行，同时给style标签加入lang="scss"属性 */
	@import "uview-plus/index.scss";
	@import "tailwindcss/base";
	@import "tailwindcss/utilities";
</style>
